﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SyOrderStateEntity
{
    public delegate SyOrderState DelegateSyOrderState(ISyOrder syOrder, SyStateContext SyStateContext);
    public class SyOrderStateHandler
    {
        private static IDictionary<SyOrderStatus, DelegateSyOrderState> DicDelegateSyOrderState = new Dictionary<SyOrderStatus, DelegateSyOrderState>()
        {
            {SyOrderStatus.WaitPay,GetSyOrderWaitPayState}
        };
        public static DelegateSyOrderState GetDelegateSyOrderState(SyOrderStatus syOrderStatus)
        {
            try
            {
                return DicDelegateSyOrderState[syOrderStatus];
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private static SyOrderState GetSyOrderWaitPayState(ISyOrder syOrder, SyStateContext syStateContext)
        {
            return new SyOrderWaitPayState(syOrder, syStateContext);
        }
    }
}
